﻿using Dapper.Sharding;

namespace TestWeb2
{
    public class DbContext
    {
        public static IClient Client { get; }

        public static IDatabase Db => Client.GetDatabase("test2");

        static DbContext()
        {
            var config = new DataBaseConfig { Password = "123" };
            Client = ShardingFactory.CreateClient(DataBaseType.MySql, config);
        }

        public static ITable<PeopleTable> People => Db.GetTable<PeopleTable>("cap_people");
    }

    [Table("Id", true)]
    public class PeopleTable
    {
        public int Id { get; set; }

        [Column(10000)]
        public string Name { get; set; }
    }

}
